﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Linq;
using System.Collections.ObjectModel;

namespace SignalLab
{
  public class AppManager
  {
    public static AppManager Instance
    {
      get
      {
        if (_Instance == null) _Instance = new AppManager();
        return _Instance;
      }
    }
    private static AppManager _Instance;

    private AppManager()
    {
      ApplicationName = "Signal Lab mobile";
      Records = new ObservableCollection<string>();
      Categories = new ObservableCollection<string>();
      GetCategories();
    } 

    public string ApplicationName { get; private set; }


    public SettingItemViewModel CurrentSetting { get; set; }

    public ObservableCollection<string> GetRecords()
    {
      Records.Clear();
      foreach(var r in System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication().GetFileNames().Where(f => !f.StartsWith("_")))
      {
        Records.Add(r);
      }
      return Records;
    }

    public ObservableCollection<string> Records;

    public ObservableCollection<string> Categories;

    public ObservableCollection<string> GetCategories()
    {
      Categories.Clear();
      foreach (var s in SettingsManager.Categories.Items)
      {
        Categories.Add(s.Name);
      }
      return Categories;
    }
 

    public string CurrentRecord { get; set; }

    public bool IsUploading;
  }
}
